package com.network.controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
public class IndexController {

    /**
     * 进入主页面
     * @return
     */
    @RequestMapping("/")
    public String index() {
        return "index";
    }


    /**
     * 退出登录
     * @param session
     * @return
     */
    @GetMapping("/exit")
    public String exit(HttpSession session) {
        session.removeAttribute("user");
        return "redirect:/login";
    }


    /**
     * 重定向到主页面
     * @return
     */
    @RequestMapping("/tmp")
    public String tmp() {
        return "redirect:/";
    }


    /**
     * 通过编号查询界面
     */
    @RequestMapping("/searchId")
    public String searchId() {
        return "search/searchId";
    }

    /**
     * 通过名字进行查询
     */
    @RequestMapping("/searchName")
    public String searchName() {
        return "search/searchName";
    }

    /**
     * 通过用户名进行查询
     */
    @RequestMapping("/searchUsername")
    public String searchUsername() {
        return "search/searchUsername";
    }


    /**
     * 通过关键字进行查询
     */
    @RequestMapping("/searchKey")
    public String searchKey() {
        return "search/searchKey";
    }



}
